package com.netty.service;

import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.SimpleChannelInboundHandler;
import io.netty.handler.codec.http.websocketx.TextWebSocketFrame;
import lombok.extern.slf4j.Slf4j;

/**
 * @author cxt
 * @date 2021/8/28
 * netty 客户端消息处理类
 */
@Slf4j
public class NettyClientHandle extends SimpleChannelInboundHandler<TextWebSocketFrame> {
//    @Override
//    protected void messageReceived(ChannelHandlerContext channelHandlerContext, TextWebSocketFrame textWebSocketFrame) throws Exception {
//        log.info("收到服务端消息：{}", textWebSocketFrame.text());
//    }

    @Override
    protected void channelRead0(ChannelHandlerContext channelHandlerContext, TextWebSocketFrame textWebSocketFrame) throws Exception {
        log.info("收到服务端消息：{}", textWebSocketFrame.text());
    }
}
